package com.qj.platform.pay.controller;

import com.qj.base.controller.BaseController;
import com.qj.base.domain.ResultTemplate;
import org.nutz.dao.Dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by hezhijie on 2016/11/17.
 */
@RestController
@RequestMapping("/secret/test")
public class SecretTestController extends BaseController {
    @Autowired
    private Dao nutzDao;

    @RequestMapping("getEnv")
    public ResultTemplate getEnv(String key){
        return getSuccessTemplate(System.getProperty(key));
    }

    @RequestMapping("/createTable")
    public ResultTemplate createTable(String className,@RequestParam(required = false,defaultValue = "false") boolean dropIfExists) throws ClassNotFoundException {
        Class clazz=Class.forName(className);
        nutzDao.create(clazz,dropIfExists);
        return getSuccessTemplate();
    }

}



